package com.ltkj.shop.service.impl;

import java.util.List;

import com.ltkj.shop.domain.ShopGoodsCenters;
import com.ltkj.shop.domain.vo.ShopStoreCentersVo;
import com.ltkj.shop.mapper.ShopStoreCentersBizMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ltkj.shop.mapper.ShopStoreCentersMapper;
import com.ltkj.shop.domain.ShopStoreCenters;
import com.ltkj.shop.service.IShopStoreCentersService;

/**
 * 商店和自提点关联Service业务层处理
 * 
 * @author xupf
 * @date 2023-08-29
 */
@Service
public class ShopStoreCentersServiceImpl implements IShopStoreCentersService 
{
    @Autowired
    private ShopStoreCentersMapper shopStoreCentersMapper;
    @Autowired
    private ShopStoreCentersBizMapper shopStoreCentersBizMapper;

    /**
     * 查询商店和自提点关联列表
     * 
     * @param shopStoreCenters 商店和自提点关联
     * @return 商店和自提点关联
     */
    @Override
    public List<ShopStoreCenters> selectShopStoreCentersList(ShopStoreCenters shopStoreCenters)
    {
        return shopStoreCentersMapper.selectShopStoreCentersList(shopStoreCenters);
    }

    /**
     * 新增商店和自提点关联
     * 
     * @param shopStoreCenters 商店和自提点关联
     * @return 结果
     */
    @Override
    public int insertShopStoreCenters(ShopStoreCentersVo shopStoreCenters)
    {
        return shopStoreCentersBizMapper.insertShopStoreCenters(shopStoreCenters);
    }

    /**
     * 批量删除商店和自提点关联
     *
     * @param shopStoreCenters   操作参数
     * @return 结果
     */
    @Override
    public int deleteShopStoreCentersByStoreIds(ShopStoreCentersVo shopStoreCenters)
    {
        return shopStoreCentersBizMapper.deleteShopStoreCenters(new Long[]{shopStoreCenters.getStoreId()}, shopStoreCenters.getCentersIds());
    }

    /**
     * 删除商店和自提点关联信息
     * 
     * @param storeId 商店主键
     * @return 结果
     */
    @Override
    public int deleteShopStoreCentersByStoreId(Long storeId)
    {
        return shopStoreCentersMapper.deleteShopStoreCentersByStoreId(storeId);
    }

    /**
     * 根据商店id查询绑定的自提点信息
     * @param storeId
     * @return
     */
    @Override
    public List<ShopGoodsCenters> selectByStoreId(Long storeId) {
        return shopStoreCentersBizMapper.selectByStoreId(storeId);
    }
}
